#!/bin/bash
stime=$(date +%s)
./skynet/3rd//lua/lua ./app/common/lib/run_check.lua
etime=$(date +%s)
if [ $[ $etime - $stime ] -ge 3 ]
then
    echo
    echo
    echo config check failed!
    echo
    exit
fi

echo
echo -e "\033[43;35m Please make sure the config is allright! \033[0m"
echo -e "\033[43;35m Type [y] to continue! \033[0m"
echo
read -n 1 M
if [ "$M" = "y" ]
then

echo
echo "-----start all server------"

echo "start-datanode"
cd ./app/datanode
../../skynet/skynet config_datanode
cd ../

ps -x |grep skynet | grep -v grep
if [ $? -eq 0 ]
then
    echo datanode run succeed!
else
    echo
    echo datanode run failed, please check config or data!
    echo
    exit
fi

sleep 2.5
echo "start---robotnode---"
cd ./robotnode
../../skynet/skynet config_robotnode
cd ../


sleep 0.5
echo "start----dnnode---"
cd ./dnnode
../../skynet/skynet config_dnnode
cd ..

sleep 0.5
echo "start----psznode---"
cd ./psznode
../../skynet/skynet config_psznode
cd ..

sleep 0.5
echo "start---brnnnode---"
cd ./brnnnode
../../skynet/skynet config_brnnnode
cd ../

sleep 0.5
echo "start---rbnode---"
cd ./rbnode
../../skynet/skynet config_rbnode
cd ../

sleep 0.5
echo "start---lhdnode---"
cd ./lhdnode
../../skynet/skynet config_lhdnode
cd ../

sleep 0.5
echo "start---ttznode---"
cd ./ttznode
../../skynet/skynet config_ttznode
cd ../

sleep 0.5
echo "start---bjlnode---"
cd ./bjlnode
../../skynet/skynet config_bjlnode
cd ../

sleep 0.5
echo "start---hbslnode---"
cd ./hbslnode
../../skynet/skynet config_hbslnode
cd ../

sleep 0.5
echo "start---bmnode---"
cd ./bmnode
../../skynet/skynet config_bmnode
cd ../

sleep 0.5
echo "start---ddznode---"
cd ./ddznode
../../skynet/skynet config_ddznode
cd ../

sleep 0.5
echo "start---mjexnode---"
cd ./mjexnode
../../skynet/skynet config_mjexnode
cd ../

sleep 0.5
echo "start---ernnnode---"
cd ./ernnnode
../../skynet/skynet config_ernnnode
cd ../

sleep 0.5
echo "start---fqzsnode---"
cd ./fqzsnode
../../skynet/skynet config_fqzsnode
cd ../

sleep 0.5
echo "start---lhjnode---"
cd ./lhjnode
../../skynet/skynet config_lhjnode
cd ../

sleep 0.5
echo "start---yydbnode---"
cd ./yydbnode
../../skynet/skynet config_yydbnode
cd ../

sleep 0.5
echo "start-----slwhnode---"
cd ./slwhnode
../../skynet/skynet config_slwhnode
cd ../

sleep 0.5
echo "start-----sgjnode---"
cd ./sgjnode
../../skynet/skynet config_sgjnode
cd ../

sleep 0.5
echo "start-----dicenode---"
cd ./dicenode
../../skynet/skynet config_dicenode
cd ../

sleep 0.5
echo "start-----dice3node---"
cd ./dice3node
../../skynet/skynet config_dice3node
cd ../

sleep 0.5
echo "start-----cpcqsscnode---"
cd ./cpcqsscnode
../../skynet/skynet config_cpcqsscnode
cd ../

sleep 0.5
echo "start-----fishnode---"
cd ./fishnode
../../skynet/skynet config_fishnode
cd ../

sleep 0.5
echo "start-----lpnode---"
cd ./lpnode
../../skynet/skynet config_lpnode
cd ../

sleep 0.5
echo "start-----pjnode---"
cd ./pjnode
../../skynet/skynet config_pjnode
cd ../

sleep 0.5
echo "start------sssnode---"
cd ./sssnode
../../skynet/skynet config_sssnode
cd ../

sleep 0.5
echo "start-----imnode---"
cd ./imnode
../../skynet/skynet config_imnode
cd ../

sleep 0.5
echo "start--loginnode---"
cd ./loginnode
../../skynet/skynet config_loginnode
cd ../

sleep 0.5
echo "start----gmnode---"
cd ./gmnode
../../skynet/skynet config_gmnode
cd ../

sleep 0.5
echo "start---gatenode---"
cd ./gatenode
../../skynet/skynet config_gatenode
cd ../

sleep 0.5
echo "start---chargenode---"
cd ./chargenode
../../skynet/skynet config_chargenode
cd ../

sleep 0.5
echo "start---zrsxnode---"
cd ./zrsxnode
../../skynet/skynet config_zrsxnode
cd ../

echo "----start all server over ------"

fi

